package com.freemyleft.left.zapp.ui.recycler;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by zuo on 2017/9/29.
 * 设置每个item的间距
 */

public class SpacesItemDecoration extends RecyclerView.ItemDecoration {

    private final int H_SPACES;
    private final int V_SPACES;

    public SpacesItemDecoration(int h_spaces, int v_spaces) {
        H_SPACES = h_spaces;
        V_SPACES = v_spaces;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.left = H_SPACES;
        outRect.right = H_SPACES;
        outRect.top = V_SPACES;
        outRect.bottom = V_SPACES;
    }
}
